import Vue from 'vue'
import Vuex from 'vuex'
import cart from './module/cart'
import products from './module/products'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    msg: 'cuvee',
    count: 0
  },
  mutations: {
    increment (state, payload) {
      state.count += payload
    }
  },
  actions: {
    incrementAsync ({ commit }, payload) {
      setTimeout(() => {
        commit('increment', payload)
      }, 2000)
    }
  },
  getters: {
    reverseMsg (state) {
      return state.msg.split('').reverse().join('')
    }
  },
  modules: {
    cart,
    products
  }
})
